﻿@using Windvoice.Blog
@using Windvoice.Library.Mvc
@{
    ViewBag.Title = "Comments";
    Layout = "~/Areas/Manage/Views/Shared/_Layout.cshtml";
}

@section headSection{
    <script type="text/javascript">
        $(function () {
            $('a[data-delete]').click(function () { $(this).handledelete('/manage/comment/delete') });
        });
    </script>
}

<div class="pagetitle">
    <h2>评论管理</h2>
</div>

<ul class="comment-list">
    @foreach (var comment in (Comment[])ViewBag.Comments)
    {
        var CommentUser = Windvoice.Authorize.User.Find(comment.UserID);
        <li>
            <div class="title">
                <a href="">
                    <img src="@CommentUser.PortraitUrl" alt="@CommentUser.DisplayName" />
                </a>
            </div>
            <div class="content">
                <div class="top">
                    <div class="information">
                        at: @(comment.CreateTime.ToString("yyyy-MM-dd HH:mm:ss")) 
                        for: @(Article.Find(comment.ArticleID).Title)
                    </div>
                    <div class="operate">
                        <a href="/manage/comment/reply/@comment.ID">回复</a>
                        <a href="javascript:;" data-delete="@comment.ID">删除</a>
                    </div>
                </div>
                <div class="comment">
                    <p class="origin">@comment.Content</p>
                    @if (!String.IsNullOrEmpty(comment.Reply))
                    {
                        <p class="reply">
                            @comment.Reply<br/>
                            @comment.ReplyTime.ToString("yyyy-MM-dd HH:mm:ss")
                        </p>
                    }             
                </div>
            </div>
            <div class="clear"></div>
        </li> 
    }
</ul>

@Html.Pager((int)ViewBag.RecordCount,PageSize:(int)ViewBag.PageSize)